<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style>
        .aqua{
            background-color: aqua;
        }
        .yellow{
            background-color: yellow;
        }
        .size{
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <div class=""id="app">
        <!-- 动态属性，与小程序不同的是，这里不能直接用{{imgUrl}} -->
        <img :src="imgUrl" alt="" @click="handleClick">
        <div class="size" :class="state?'yellow':'aqua'"></div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                state:false,
                imgUrl:'https://www.runoob.com/wp-content/uploads/2017/01/vue.png'
            },
            methods:{
                handleClick(){
                    this.state=!this.state;
                    console.log(444);
                    console.log(this.state);
                }
            }
        })
    </script>
</body>
</html>